package com.ruoyi.system.interAttr.service;

import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.V2.inter.mapper.SalePartnerMapper;
import com.ruoyi.system.interAttr.attr.*;
import com.ruoyi.system.interAttr.domain.GamesRes;
import com.ruoyi.system.interAttr.domain.InterAttrRes;
import com.ruoyi.system.interAttr.domain.InterServerRes;
import com.ruoyi.system.interfacechannel.domain.InterfaceChannel;
import com.ruoyi.system.interfacechannel.mapper.InterfaceChannelMapper;
import com.ruoyi.system.model.domain.SalePartner;
import com.ruoyi.system.outto.core.LCConstant;
import com.ruoyi.system.outto.goods.DD373API;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @author lz
 * @version 1.0
 * @date 2024/6/19 9:04
 */
@Component
public class InterGetAttr {


    @Autowired
    KeJinShouAttr keJinShouAttr;

    @Autowired
    TAOHAOHAOAttr taohaohaoAttr;
    @Autowired
    JIAOYIYOUAttr jiaoyiyouAttr;
    @Autowired
    NEW7881Attr new7881Attr;
    @Autowired
    YUDUAttr yuduAttr;
    @Autowired
    NEW51YOUXIAttr new51YOUXIAttr;
    @Autowired
    PXAttr pxAttr;
    @Autowired
    HUANHAOBAAttr huanhaobaAttr;
    @Autowired
    XINGHEAttr xingheAttr;
    @Autowired
    CHUANGYOUAttr chuangyouAttr;
    @Autowired
    MAIGEHAOWANAttr maigehaowanAttr;
    @Autowired
    QIFEIAttr qifeiAttr;
    @Autowired
    MiMaAttr miMaAttr;
    @Autowired
    MAIGEHAOAttr maigehaoAttr;
    @Autowired
    NEWYSYAttr newysyAttr;
    @Autowired
    THGAttr thgAttr;
    @Autowired
    MKeJinShouAttr mKeJinShouAttr;
    @Autowired
    NEW5173Attr new5173Attr;
    @Autowired
    NiGuangAttr niGuangAttr;
    @Autowired
    ENYOUAttr enyouAttr;
    @Autowired
    KAIGEAttr kaigeAttr;
    @Autowired
    JINGMENGYOUAttr jingmengyouAttr;
    @Autowired
    YOUZHIJINGAttr youzhijingAttr;
    @Autowired
    TIANCHENAttr tianchenAttr;
    @Autowired
    XIZAIAttr xizaiAttr;
    @Autowired
    MAIHAOXIONGAttr maihaoxiongAttr;
    @Autowired
    KANGEHAOAttr kangehaoAttr;
    @Autowired
    FEIHENGAttr feihengAttr;
    @Autowired
    AISHANGYOUAttr aishangyouAttr;
    @Autowired
    TIANXIAYOUAttr tianxiayouAttr;
    @Autowired
    QMLAttr qmlAttr;
    @Autowired
    THWAttr thwAttr;
    @Autowired
    ZHAOHAOWANAttr zhaohaowanAttr;
    @Autowired
    KEXINHUYUAttr kexinhuyuAttr;
    @Autowired
    PAOYANGAttr paoyangAttr;
    @Autowired
    LXYAttr lxyAttr;
    @Autowired
    ZHGAttr zhgAttr;
    @Autowired
    DGGAttr dggAttr;
    @Autowired
    LONGXIAAttr longxiaAttr;
    @Autowired
    YXGAttr yxgAttr;
    @Autowired
    AMAttr amAttr;
    @Autowired
    RENYIAttr renyiAttr;
    @Autowired
    TANXINZHUAttr tanxinzhuAttr;
    @Autowired
    YOUXIBAOAttr youxibaoAttr;
    @Autowired
    CHANGYOUTANGAttr changyoutangAttr;
    @Autowired
    MONIMiMaAttr moniMiMaAttr;
    @Autowired
    TAOSHOUYOUAttr taoshouyouAttr;
    @Autowired
    YUDUHULIANAttr yuduhulianAttr;
    @Autowired
    TWMAttr twmAttr;
    @Autowired
    MONITAOHHAttr monitaohhAttr;
    @Autowired
    MONIYOUXIGEAttr moniyouxigeAttr;
    @Autowired
    MONITAOSHOUYOUAttr monitaoshouyouAttr;
    @Autowired
    HEITAOAttr heitaoAttr;
    @Autowired
    KANKANAttr kankanAttr;
    @Autowired
    KKZHWAttr kkzhwAttr;
    @Autowired
    DD373Attr dd373Attr;
    @Autowired
    MUMUDAISHOUAttr mumudaishouAttr;
    @Autowired
    BAIZEAttr baizeAttr;
    @Autowired
    YLDSAttr yldsAttr;
    @Autowired
    TAOHAOYAAttr taohaoyaAttr;
    @Autowired
    MONI7881Attr moni7881Attr;
    @Autowired
    NEWZUYOULEAttr newzuyouleAttr;
    @Autowired
    MONIYSYAttr moniysyAttr;
    @Autowired
    YUNCANGAttr yuncangAttr;
    @Autowired
    SHENXIANAttr shenxianAttr;
    @Autowired
    MONIXIZAIAttr monixizaiAttr;
    @Autowired
    SHIQIAttr shiqiAttr;

    @Resource
    private SalePartnerMapper salePartnerMapper;
    @Resource
    private InterfaceChannelMapper interfaceChannelMapper;

    /**
     * 根据渠道查询所有接口
     */
    public List<SalePartner> getSalePartnerByInterfaceChanner(Long config){
        InterfaceChannel interfaceChannel = interfaceChannelMapper.selectById(config);
        SalePartner salePartner = new SalePartner();
        salePartner.setSaleName(interfaceChannel.getCode());
        List<SalePartner> salePartners = salePartnerMapper.selectSalePartnerList(salePartner);
        if(CollectionUtils.isNotEmpty(salePartners)){
            return salePartners;
        }
        return null;
    }

    /**
     * 获取游戏列表
     *
     * @param
     * @return
     */
    public List<GamesRes> getGames(String config) {
        SalePartner salePartner = salePartnerMapper.selectSalePartnerSaleCode(config);

        List<GamesRes> games = new ArrayList<>();

        if (salePartner.getSaleName().contains(LCConstant.saleNameKJS)) {
            try {
                games = keJinShouAttr.getGames();
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOHH)) {
            try {
                games = taohaohaoAttr.getGames(salePartner.getTwoOther(), salePartner.getSaleKey());
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleNameJYY)) {
            try {
                games = jiaoyiyouAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleName7881)) {
            try {
                games = new7881Attr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUDU)) {
            try {
                games = yuduAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameHHB)) {
            try {
                games = huanhaobaAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMGH)) {
            try {
                games = maigehaoAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYSY)) {
            try {
                games = newysyAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleNameTHG)) {
            try {
                games = thgAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTHW)) {
            try {
                games = thwAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameLXY)) {
            try {
                games = lxyAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameDGG)) {
            try {
                games = dggAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYXG)) {
            try {
                games = yxgAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameXIZAI)) {
            try {
                games = xizaiAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMMM)) {
            try {
                games = miMaAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameCHUANGYOU)) {
            try {
                games = chuangyouAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameFEIHENG)) {
            try {
                games = feihengAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameZHG)) {
            try {
                games = zhgAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNamePOXIAO)) {
            try {
                games = pxAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameENYOU)) {
            try {
                games = enyouAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameQML)) {
            try {
                games = qmlAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameZHW)) {
            try {
                games = zhaohaowanAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameKGH)) {
            try {
                games = kangehaoAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMKEJINSHOU)) {
            try {
                games = mKeJinShouAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameXINGHE)) {
            try {
                games = xingheAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameCYT)) {
            try {
                games = changyoutangAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIMIMA)) {
            try {
                games = moniMiMaAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOSHOUYOU)) {
            try {
                games = taoshouyouAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleName5173)) {
            try {
                games = new5173Attr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMAIHAOXIONG)) {
            try {
                games = maihaoxiongAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYDHULIAN)) {
            try {
                games = yuduhulianAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameNIGUANG)) {
            try {
                games = niGuangAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTWM)) {
            try {
                games = twmAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONITAOHAOHAO)) {
            try {
                games = monitaohhAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIYOUXIGE)) {
            try {
                games = moniyouxigeAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameQIANTSQ)) {
            try {
                games = monitaoshouyouAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameHEITAO)) {
            try {
                games = heitaoAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTANXINZHU)) {
            try {
                games = tanxinzhuAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameRENYI)) {
            try {
                games = renyiAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameKANKAN)) {
            try {
                games = kkzhwAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameDD373)) {
            try {
                games = dd373Attr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMUMUDAISHOU)) {
            try {
                games = mumudaishouAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameBAIZE)) {
            try {
                games = baizeAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUELIANGDS)) {
            try {
                games = yldsAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOHAOYA)) {
            try {
                games = taohaoyaAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONI788ONE)) {
            try {
                games = moni7881Attr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameNEWZUYOULE)) {
            try {
                games = newzuyouleAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYISHOUYOU)) {
            try {
                games = moniysyAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUNCANG)) {
            try {
                games = yuncangAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameSHENXIAN)) {
            try {
                games = shenxianAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIXIZAI)) {
            try {
                games = monixizaiAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameSHIQI)) {
            try {
                games = shiqiAttr.getGames(salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else{
            throw new GlobalException("其他平台获取还在开发中");
        }
        return games;
    }

    public List<InterServerRes> getServers(String config, String gameId) {
        SalePartner salePartner = salePartnerMapper.selectSalePartnerSaleCode(config);

        if (Objects.isNull(salePartner)) {
            throw new GlobalException("接口不能为空");
        }

        List<InterServerRes> serverRes = new ArrayList<>();

        if (salePartner.getSaleName().contains(LCConstant.saleNameKJS)) {
            try {
                serverRes = keJinShouAttr.getServer(gameId);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOHH)) {
            try {
                serverRes = taohaohaoAttr.getServer(salePartner.getTwoOther(), salePartner.getSaleKey(), gameId);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameJYY)) {
            try {
                serverRes = jiaoyiyouAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleName7881)) {
            try {
                serverRes = new7881Attr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUDU)) {
            try {
                serverRes = yuduAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameHHB)) {
            try {
                serverRes = huanhaobaAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMGH)) {
            try {
                serverRes = maigehaoAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYSY)) {
            try {
                serverRes = newysyAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTHG)) {
            try {
                serverRes = thgAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTHW)) {
            try {
                serverRes = thwAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameLXY)) {
            try {
                serverRes = lxyAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameDGG)) {
            try {
                serverRes = dggAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYXG)) {
            try {
                serverRes = yxgAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameXIZAI)) {
            try {
                serverRes = xizaiAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMMM)) {
            try {
                serverRes = miMaAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameCHUANGYOU)) {
            try {
                serverRes = chuangyouAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameFEIHENG)) {
            try {
                serverRes = feihengAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameZHG)) {
            try {
                serverRes = zhgAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNamePOXIAO)) {
            try {
                serverRes = pxAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameENYOU)) {
            try {
                serverRes = enyouAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameQML)) {
            try {
                serverRes = qmlAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameZHW)) {
            try {
                serverRes = zhaohaowanAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameKGH)) {
            try {
                serverRes = kangehaoAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMKEJINSHOU)) {
            try {
                serverRes = mKeJinShouAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameXINGHE)) {
            try {
                serverRes = xingheAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameCYT)) {
            try {
                serverRes = changyoutangAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIMIMA)) {
            try {
                serverRes = moniMiMaAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOSHOUYOU)) {
            try {
                serverRes = taoshouyouAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleName5173)) {
            try {
                serverRes = new5173Attr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMAIHAOXIONG)) {
            try {
                serverRes = maihaoxiongAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYDHULIAN)) {
            try {
                serverRes = yuduhulianAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameNIGUANG)) {
            try {
                serverRes = niGuangAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTWM)) {
            try {
                serverRes = twmAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONITAOHAOHAO)) {
            try {
                serverRes = monitaohhAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIYOUXIGE)) {
            try {
                serverRes = moniyouxigeAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameQIANTSQ)) {
            try {
                serverRes = monitaoshouyouAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameHEITAO)) {
            try {
                serverRes = heitaoAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTANXINZHU)) {
            try {
                serverRes = tanxinzhuAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameRENYI)) {
            try {
                serverRes = renyiAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameKANKAN)) {
            try {
                serverRes = kkzhwAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameDD373)) {
            try {
                serverRes = dd373Attr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMUMUDAISHOU)) {
            try {
                serverRes = mumudaishouAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameBAIZE)) {
            try {
                serverRes = baizeAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUELIANGDS)) {
            try {
                serverRes = yldsAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOHAOYA)) {
            try {
                serverRes = taohaoyaAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONI788ONE)) {
            try {
                serverRes = moni7881Attr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameNEWZUYOULE)) {
            try {
                serverRes = newzuyouleAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYISHOUYOU)) {
            try {
                serverRes = moniysyAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUNCANG)) {
            try {
                serverRes = yuncangAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameSHENXIAN)) {
            try {
                serverRes = shenxianAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIXIZAI)) {
            try {
                serverRes = monixizaiAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameSHIQI)) {
            try {
                serverRes = shiqiAttr.getServer(gameId,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else{
            throw new GlobalException("其他平台获取还在开发中");
        }
        return serverRes;
    }


    public List<InterAttrRes> getAttr(String gameId, String type, String config) {

        SalePartner salePartner = salePartnerMapper.selectSalePartnerSaleCode(config);

        if (Objects.isNull(salePartner)) {
            throw new GlobalException("接口不能为空");
        }

        List<InterAttrRes> interAttrRes = new ArrayList<>();

        if (salePartner.getSaleName().contains(LCConstant.saleNameKJS)) {
            try {
                interAttrRes = keJinShouAttr.getPropety(Long.valueOf(gameId), type);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOHH)) {
            try {
                interAttrRes = taohaohaoAttr.getPropety(salePartner.getTwoOther(), salePartner.getSaleKey(), gameId, type);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleNameJYY)) {
            try {
                interAttrRes = jiaoyiyouAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        } else if (salePartner.getSaleName().contains(LCConstant.saleName7881)) {
            try {
                interAttrRes = new7881Attr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUDU)) {
            try {
                interAttrRes = yuduAttr.getPropety(gameId, type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameHHB)) {
            try {
                interAttrRes = huanhaobaAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMGH)) {
            try {
                interAttrRes = maigehaoAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYSY)) {
            try {
                interAttrRes = newysyAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTHG)) {
            try {
                interAttrRes = thgAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTHW)) {
            try {
                interAttrRes = thwAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameLXY)) {
            try {
                interAttrRes = lxyAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameDGG)) {
            try {
                interAttrRes = dggAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYXG)) {
            try {
                interAttrRes = yxgAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameXIZAI)) {
            try {
                interAttrRes = xizaiAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMMM)) {
            try {
                interAttrRes = miMaAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameCHUANGYOU)) {
            try {
                interAttrRes = chuangyouAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameFEIHENG)) {
            try {
                interAttrRes = feihengAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameZHG)) {
            try {
                interAttrRes = zhgAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNamePOXIAO)) {
            try {
                interAttrRes = pxAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameENYOU)) {
            try {
                interAttrRes = enyouAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameQML)) {
            try {
                interAttrRes = qmlAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameZHW)) {
            try {
                interAttrRes = zhaohaowanAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameKGH)) {
            try {
                interAttrRes = kangehaoAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMKEJINSHOU)) {
            try {
                interAttrRes = mKeJinShouAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameXINGHE)) {
            try {
                interAttrRes = xingheAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameCYT)) {
            try {
                interAttrRes = changyoutangAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIMIMA)) {
            try {
                interAttrRes = moniMiMaAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOSHOUYOU)) {
            try {
                interAttrRes = taoshouyouAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleName5173)) {
            try {
                interAttrRes = new5173Attr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMAIHAOXIONG)) {
            try {
                interAttrRes = maihaoxiongAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYDHULIAN)) {
            try {
                interAttrRes = yuduhulianAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameNIGUANG)) {
            try {
                interAttrRes = niGuangAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTWM)) {
            try {
                interAttrRes = twmAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONITAOHAOHAO)) {
            try {
                interAttrRes = monitaohhAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIYOUXIGE)) {
            try {
                interAttrRes = moniyouxigeAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameQIANTSQ)) {
            try {
                interAttrRes = monitaoshouyouAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameHEITAO)) {
            try {
                interAttrRes = heitaoAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTANXINZHU)) {
            try {
                interAttrRes = tanxinzhuAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameRENYI)) {
            try {
                interAttrRes = renyiAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameKANKAN)) {
            try {
                interAttrRes = kkzhwAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameDD373)) {
            try {
                interAttrRes = dd373Attr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMUMUDAISHOU)) {
            try {
                interAttrRes = mumudaishouAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameBAIZE)) {
            try {
                interAttrRes = baizeAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUELIANGDS)) {
            try {
                interAttrRes = yldsAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameTAOHAOYA)) {
            try {
                interAttrRes = taohaoyaAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONI788ONE)) {
            try {
                interAttrRes = moni7881Attr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameNEWZUYOULE)) {
            try {
                interAttrRes = newzuyouleAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYISHOUYOU)) {
            try {
                interAttrRes = moniysyAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameYUNCANG)) {
            try {
                interAttrRes = yuncangAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameSHENXIAN)) {
            try {
                interAttrRes = shenxianAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameMONIXIZAI)) {
            try {
                interAttrRes = monixizaiAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else if (salePartner.getSaleName().contains(LCConstant.saleNameSHIQI)) {
            try {
                interAttrRes = shiqiAttr.getPropety(gameId,type,salePartner);
            } catch (GlobalException s) {
                s.printStackTrace();
            }
        }else{
            throw new GlobalException("其他平台获取还在开发中");
        }
        return interAttrRes;
    }

  public List<InterAttrRes> getCheckAttr(String gameId, String type, String config) {

        SalePartner salePartner = salePartnerMapper.selectSalePartnerSaleCode(config);
        if (Objects.isNull(salePartner)) {
            throw new GlobalException("接口不能为空");
        }
      List<InterAttrRes> interAttrRes = getAttr(gameId, type, config);

      List<InterAttrRes> resultList = new ArrayList<>();
      if (CollectionUtils.isNotEmpty(interAttrRes)) {
          for (InterAttrRes interAttrRe : interAttrRes) {
              if (CollectionUtils.isNotEmpty(interAttrRe.getInterServerRes())) {
                  for (InterAttrRes interServerRe : interAttrRe.getInterServerRes()) {
                      if (CollectionUtils.isNotEmpty(interServerRe.getInterServerRes())) {
                          for (InterAttrRes interServerRe1 : interServerRe.getInterServerRes()) {
                                  resultList.add(interServerRe1);
                          }
                      }else{
                          resultList.add(interServerRe);
                      }
                  }
              } else {
                  resultList.add(interAttrRe);
              }
          }
      }
      return resultList;
  }

    public static String getCover(Map<String, Object> params) {
        StringBuffer resut = new StringBuffer();
        for (String key : params.keySet()) {
            if (params.get(key) instanceof String && StringUtils.isNotEmpty((String) params.get(key))) {
                resut.append(key + "=" + params.get(key) + "&");
            }
            if (params.get(key) instanceof Boolean) {
                resut.append(key + "=" + params.get(key) + "&");
            }
            if (params.get(key) instanceof Long) {
                resut.append(key + "=" + params.get(key) + "&");
            }
            if (params.get(key) instanceof Integer && null != params.get(key)) {
                resut.append(key + "=" + params.get(key) + "&");
            }
        }
        return resut.toString();
    }
}
